package rma.flp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class DeletePictureController {

	PictureRepository pictureRepository;

	@Autowired
	public DeletePictureController(PictureRepository pictureRepository) {
		this.pictureRepository = pictureRepository;
	}
	
	@RequestMapping("/delete")
	public String delete(@RequestParam("id") Long id) {
		pictureRepository.delete(id);
		return "redirect:gallery";
	}
	
}
